%conjuntos pseudo-trapezoidales

ntrap = 7;
posA = zeros(ntrap,1);
posA(1) = [-10,-10,-8,-7]; %frio
posA(2) = [-8,-7,-5,-4]; %muy_fresco
posA(3) = [-5,-4,-1,0]; %fresco
posA(4) = [-1,0,0,1]; %correcto
posA(5) = [0,1,4,5]; %caluroso
posA(6) = [4,5,7,8]; %muy caluroso
posA(7) = [7,8,10,10]; %caliente

tmin = -10;
tmax = 10;
step = 0.5;

npart = (tmax-tmin)/step;

A = zeros(ntrap,npart);
i = 1;
h = 1; %normalizo el set
xnod = zeros(npart,1);

for x=tmin:step:tmax
   xnod(i) = x;
   for j=1:ntrap
       a = posA(j,1);
       b = posA(j,2);
       c = posA(j,3);
       d = posA(j,4);
       if(x>=a||x<b)
           A(i,j) = (x-a)/(b-a);
       else
           if(x>=b&&x<c)
               A(i,j) = h;
           else
               if(x>=c&&x<d)
                   A(i,j) =  (x-c)/(d-c);
               else
                   A(i,j) = 0;
               end
           end
       end
   end
   i = i+1;
end
       
                   

